﻿@model OrderDetailsModel
@using Nop.Core.Domain.Orders;
@using Nop.Web.Models.Order;
@using Nop.Services.Localization;

<div class="order-details">
    @if (Model.Items.Count > 0)
    {
        <div class="products">
            <div class="invoice col-xs-12 col-sm-12 col-md-12 col-lg-12">
                @T("Order.Order#")@Model.Id - @T("Order.Notes.CreatedOn") @Model.CreatedOn.ToString()
                <a href="@Url.RouteUrl("OrderDetails", new { orderID = @Model.Id }) " title="view invoice">View Details</a>
            </div>
                    @foreach (var item in Model.Items)
                    {

                            <div class="cart-store-item col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                <div class="row">
                                    <div class="cart-image col-xs-2 col-sm-2 col-md-2 col-lg-2">
                                        <div class="cart-store-item-image">
                                            <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })"><img alt="@item.PictureModel.AlternateText" src="@item.PictureModel.ImageUrl" /></a>
                                        </div>
                                    </div>

                                    <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
                                        <div class="cart-store-item-name">
                                            <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })"><h4>@item.ProductName</h4></a>
                                        </div>
                                    @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                    {
                                        @Html.Raw(item.AttributeInfo)
                                    }
                                </div>
                                <div class="cart-quantity col-xs-3 col-sm-3 col-md-3 col-lg-3">
                                    <strong>Quantity</strong> <br />
                                    <span>@item.Quantity</span>
                                </div>

                                <div class="cart-subtotal col-xs-3 col-sm-3 col-md-3 col-lg-3">
                                    <strong>Total</strong> <br />
                                    <span class="product-subtotal">@item.SubTotal</span>
                                </div>
                            </div>
                            </div>
                            }

                            @if (!String.IsNullOrEmpty(Model.CheckoutAttributeInfo))
                    {
                                <div class="checkout-attributes">
                                    @Html.Raw(Model.CheckoutAttributeInfo)
                                </div>
                    }

                        </div>

        }

        @Html.Widget("orderdetails_page_afterproducts")

        @if (!Model.PrintMode)
        {
            if (Model.Shipments.Count > 0)
            {
            <div class="section-title">
                @T("Order.Shipments")
            </div>
            <div class="shipments-box">
                <table class="data-table">

                    <thead>
                        <tr>
                            <th class="a-center">
                                @T("Order.Shipments.ID")
                            </th>
                            <th class="a-center">
                                @T("Order.Shipments.TrackingNumber")
                            </th>
                            <th class="a-center">
                                @T("Order.Shipments.ShippedDate")
                            </th>
                            <th class="a-center">
                                @T("Order.Shipments.DeliveryDate")
                            </th>
                            <th class="a-center">
                                @T("Order.Shipments.ViewDetails")
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.Shipments)
                        {
                            <tr>
                                <td class="a-left">
                                    @item.Id.ToString()
                                </td>
                                <td class="a-left">
                                    @item.TrackingNumber
                                </td>
                                <td class="a-left">
                                    @if (item.ShippedDate.HasValue)
                                    {
                                        @item.ShippedDate.Value.ToString("D")
                                    }
                                    else
                                    {
                                        @T("Order.Shipments.ShippedDate.NotYet")
                                    }
                                </td>
                                <td class="a-left">
                                    @if (item.DeliveryDate.HasValue)
                                    {
                                        @item.DeliveryDate.Value.ToString("D")
                                    }
                                    else
                                    {
                                        @T("Order.Shipments.DeliveryDate.NotYet")
                                    }
                                </td>
                                <td class="a-center">
                                    <a href="@Url.RouteUrl("ShipmentDetails", new { shipmentId = item.Id })" title="@T("Order.Shipments.ViewDetails")">@T("Order.Shipments.ViewDetails")</a>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            }
        }

        @if (!Model.PrintMode)
        {
            if (Model.OrderNotes.Count > 0)
            {
            <div class="section-title">
                @T("Order.Notes")
            </div>
            <div class="clear">
            </div>
            <div class="ordernotes-box">
                <table class="data-table">

                    <thead>
                        <tr>
                            <th class="a-center">
                                @T("Order.Notes.CreatedOn")
                            </th>
                            <th class="a-center">
                                @T("Order.Notes.Note")
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.OrderNotes)
                        {
                            <tr>
                                <td class="a-left">
                                    @item.CreatedOn.ToString()
                                </td>
                                <td class="a-left">
                                    @Html.Raw(item.Note)
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            }
        }
        @Html.Widget("orderdetails_page_bottom")

    </div>
